package designpattern.Iterator;

/**
 * Created by luzl on 8/22/2017.
 */
public class MyIteratorImpl implements MyContainer{
    String[] data=new String[]{"name1","name2","name3"};

    @Override
    public MyIterator getIterator() {
        return null;
    }

    private class Itr implements MyIterator{
        int i=0;
        @Override
        public boolean hasNext() {
            if (i==data.length){
                return false;
            }else{
                return true;
            }
        }

        @Override
        public Object next() {
            Object el=data[i];
            i++;
            return el;
        }
    }
}
